"""hams URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
import notifications.urls
from django.contrib import admin
from django.urls import path,re_path
from django.views.decorators.cache import cache_page

from django.conf.urls import include
from django.views.generic import TemplateView
from django.views.static import serve
from myproject.settings import MEDIA_ROOT



from users.views_user import LoginView, IndexView, LogoutView
from system.views import SystemView
from criterion.views import CriteriaView, CriterionEditView, JsonLevel6ClauseListView, RefContentView, \
    ReviewReferenceDetailView


from news.views import *
    # ProgressView,ProgressDashboardView,ProgressOverallView,ProgressUserView,ProgressLogView,ProgressOverallJsonView

from news.views import NewsView
from adm.views import AdmView
from personal import views as personal_views
from personal import views_work_order as order
from criterion import  views as citerion_views



urlpatterns = [
    path('equipment/', include('equipment.urls')),
    # 后台和首页
    path('admin/', admin.site.urls),
    path('', IndexView.as_view(), name='index'),
    re_path(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}),
    # path('', IndexView.as_view(), name='index'),
    path('ckeditor/', include('ckeditor_uploader.urls')),
    path('test/',citerion_views.test),
    path('inbox/notifications/', include(notifications.urls, namespace='notifications')),

    # 用户登录
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(), name="logout"),

    # 系统管理
    path('system/', SystemView.as_view(), name="system"),
    path('system/basic/', include('users.urls', namespace='system-basic')),
    path('system/rbac/', include('rbac.urls', namespace='system-rbac')),
    path('system/tools/', include('system.urls', namespace='system-tools')),


    # 标准查阅
    # path('criterion_view/', CriteriaView.as_view(), name="criterion_view"),
    path('criteria/', CriteriaView.as_view(), name="criteria"),
    path('criteria/<int:criteria_id>/', CriteriaView.as_view(), name="criteria_bid"),
    path('criteria/<int:criteria_id>/<int:clause_id>', CriteriaView.as_view(), name="criterion_bid_cid"),

    path('criterion/reference/', ReviewReferenceDetailView.as_view(), name="criterion-reference"),

    # path('criterion_view/<int:num>', CriteriaView.as_view(), name="criterion_view"),

    path('criterion/level6_clause_list/', JsonLevel6ClauseListView.as_view(), name="criterion_level6_clause_list"),
    path('criterion/relcontent/<int:num>', RefContentView.as_view(), name="criterion_relcontent"),

    # 标准编辑
    path('system/criterion_edit/', CriterionEditView.as_view(), name="criterion_edit"),


    # 行政管理
    re_path(r'^adm/$', AdmView.as_view(), name="adm-main"),
    re_path(r'^adm/bsm/', include('adm.urls', namespace='adm-bsm')),
    re_path(r'^adm/equipment/', include('adm.urls_equipment', namespace='adm-equipment')),
    re_path(r'^adm/asset/', include('adm.urls_asset', namespace='adm-asset')),

    # 工作台

    path('system/userinfo', personal_views.UserInfoView.as_view(), name="personal-user_info"),
    path('system/uploadimage', personal_views.UploadImageView.as_view(), name="personal-uploadimage"),
    path('system/passwordchange', personal_views.PasswdChangeView.as_view(), name="personal-passwordchange"),

    path('adm/phonebook', personal_views.PhoneBookView.as_view(), name="personal-phonebook"),


    re_path(r'^adm/workorder_Icrt/$', order.WorkOrderView.as_view(), name="personal-workorder_Icrt"),
    re_path(r'^adm/workorder_Icrt/list', order.WorkOrderListView.as_view(), name="personal-workorder-list"),
    re_path(r'^adm/workorder_Icrt/create', order.WorkOrderCreateView.as_view(), name="personal-workorder-create"),
    re_path(r'^adm/workorder_Icrt/detail', order.WorkOrderDetailView.as_view(), name="personal-workorder-detail"),
    re_path(r'^adm/workorder_Icrt/delete', order.WorkOrderDeleteView.as_view(), name="personal-workorder-delete"),
    re_path(r'^adm/workorder_Icrt/update', order.WorkOrderUpdateView.as_view(), name="personal-workorder-update"),
    re_path(r'^adm/workorder_Icrt/upload', order.WorkOrderProjectUploadView.as_view(),
            name="personal-workorder-project-upload"),

    re_path(r'^adm/workorder_app/$', order.WorkOrderView.as_view(), name="personal-workorder_app"),
    re_path(r'^adm/workorder_app/send', order.WrokOrderSendView.as_view(), name="personal-workorder-send"),
    re_path(r'^adm/workorder_rec/$', order.WorkOrderView.as_view(), name="personal-workorder_rec"),
    re_path(r'^adm/workorder_rec/execute', order.WorkOrderExecuteView.as_view(), name="personal-workorder-execute"),
    re_path(r'^adm/workorder_rec/finish', order.WorkOrderFinishView.as_view(), name="personal-workorder-finish"),
    re_path(r'^adm/workorder_rec/upload', order.WorkOrderUploadView.as_view(), name="personal-workorder-upload"),
    re_path(r'^adm/workorder_rec/return', order.WorkOrderReturnView.as_view(), name="personal-workorder-return"),

    re_path(r'^adm/workorder_all/$', order.WorkOrderView.as_view(), name="personal-workorder_all"),

    re_path(r'^adm/document/$', order.WorkOrderDocumentView.as_view(), name="personal-document"),
    re_path(r'^adm/document/list', order.WorkOrderDocumentListView.as_view(), name="personal-document-list"),
    path('test',TemplateView.as_view(template_name="test.html")),

    # path('equipment/', include('equipment.urls'))
]
